package com.car.controller;

import com.car.domain.CarCoupon;
import com.car.service.CarCouponService;
import com.car.utils.Result;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/coupon")
public class CouponController {

    @Autowired
    private CarCouponService CarCouponService;

    @RequestMapping("/list")
    public Result list(Integer current, Integer size){
        PageHelper.startPage(current,size);
        List<CarCoupon> list = CarCouponService.list();
        PageInfo<CarCoupon> pageInfo = new PageInfo<>(list);
        return Result.success(pageInfo);
    }
}
